package com.fesine.ssh.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

/**
 * UUID主键工具类,用于生成主键id
 * @author Fesine
 * Created by Fesine on 2016/2/16.
 */
public class GenerateUUID {

    public static String getUUId(){
        String s = UUID.randomUUID().toString();
        //去掉“-”符号
        return s.substring(0, 8) + s.substring(9, 13)
                + s.substring(14, 18) + s.substring(19, 23) + s.substring(24);
    }

    public static String getProdId(){
        //PRD201602212316001
        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmsssss");
        String prodId = "PRD"+ sdf.format(date);
        return prodId;
    }

    //public static void main(String[] args) {
    //    System.out.println(getProdId());
    //}


}
